<?php
class ChannelProduct_model extends CI_Model {
    public $tabName;

    public function __construct()
    {
        $this->tabName = "kfsy_channel_store.kf_channel_product";
    }
    
    /*
        获取渠道商品列表
        params
            chn_id 渠道id
            store_id 店铺id
    */
    public function getProductList($chn_id = 0, $store_id = 0)
    {
        $where = array(
            "fk_channel_id" => $chn_id,
            "fk_store_id" => $store_id
        );

        $productList = $this->db
            ->order_by("id asc")
            ->get_where($this->tabName, $where)
            ->result_array();

        $productList = $this->setCategoryName($chn_id, $store_id, $productList);
        $productList = $this->setProductName($productList);

        return $productList;
    }

    /*
        获取店铺所有渠道商品价格
        params
            store_id 店铺id
    */
    public function getAllOtherPriceByStoreId($store_id = 0)
    {
        $where = array(
            "fk_store_id" => $store_id
        );

        $productList = $this->db
            ->select("fk_product_id,fk_channel_id,fk_product_id,other_product_id,product_price")
            ->where($where)
            ->get($this->tabName)
            ->result_array();

        return $productList;
    }

    /*
        获取渠道商品id列表
        params
            chn_id 渠道id
            store_id 店铺id
    */
    public function getOtherPorudctId($chn_id = 0, $store_id = 0)
    {
        $where = array(
            "fk_channel_id" => $chn_id,
            "fk_store_id" => $store_id
        );

        $productList = $this->db
            ->select("fk_product_id")
            ->order_by("id asc")
            ->get_where($this->tabName, $where)
            ->result_array();

        $res = array();

        foreach ($productList as $key => $value) {
            $res[] = $value['fk_product_id'];
        }

        return $res;

    }

    /*
        设置分类名称
        params
            chn_id 渠道id
            store_id 店铺id
            product_list 商品信息列表
    */
    public function setCategoryName($chn_id = 0, $store_id = 0, $product_list = array())
    {
        $categoryName = $this->getCategoryName($chn_id, $store_id);

        foreach ($product_list as $key => $value) {
            $tmpName = $categoryName[$value['other_category_id']];

            $product_list[$key]['other_category_name'] = $tmpName ? $tmpName : "-";
        }

        return $product_list;
    }

    /*
        设置商品名称
        params
            product_list 商品信息列表
    */
    public function setProductName($product_list = array())
    {
        $productId = array();

        foreach ($product_list as $key => $value) {
            $productId[] = $value['fk_product_id'];
        }

        $productName = $this->getProductName($productId);

        foreach ($product_list as $key => $value) {
            $tmpName = $productName[$value['fk_product_id']];
            $tmpName = $tmpName ? $tmpName : $value['fk_product_id'];

            $tmpStatus = $productStatus[$value['product_status']];

            $tmpPrice = number_format($value['product_price'] / 100, 2);
            
            $product_list[$key]['product_name'] = $tmpName;
            $product_list[$key]['product_price'] = $tmpPrice;
        }

        return $product_list;
    }

    /*
        获取商品状态
    */
    public function getProductStatus()
    {
        $res = array(
            "1" => "上架",
            "2" => "下架",
        );

        return $res;
    }

    /*
        获取第三方分类名称
        params
            chn_id 渠道id
            store_id 店铺id
    */
    public function getCategoryName($chn_id = 0, $store_id = 0)
    {
        $this->load->model("ChannelCategory_model", "ChannelCategoryModel");
        $ChannelCategoryModel = $this->ChannelCategoryModel;

        return $ChannelCategoryModel->getCategoryName($chn_id, $store_id);
    }

    /*
        获取药品名称
        params
            product_id[] 药品id数组
    */
    public function getProductName($product_id = array())
    {
        $this->load->model("Product_model", "ProductModel");
        $ProductModel = $this->ProductModel;

        return $ProductModel->getProductNameById($product_id);
    }

    /*
        获取同步商品列表
        params
            chn_id 渠道id
            store_id 店铺id
    */
    public function getSyncProductList($chn_id = 0, $store_id = 0)
    {
        $storeProduct = $this->getStoreProductId($store_id);
        $otherProduct = $this->getOtherPorudctId($chn_id, $store_id);

        $syncProduct = array_diff($storeProduct, $otherProduct);

        $field = array(
            "ID",
            "CompanyName",
            "Caption",
            "ModeSize",
            "AppClass",
            "LSJG"
        );

        $field = implode(", ", $field);
        $productInfo = $this->getProductInfoById($syncProduct, $field);

        $productInfo = $this->setProductOtherCategory($chn_id, $store_id, $productInfo);

        return array_values($productInfo);
    }

    /*
        提交同步商品请求
        params
            chn_id 渠道id
            store_id 店铺id
    */
    public function commitSyncProduct($chn_id = 0, $store_id = 0)
    {
        $storeProduct = $this->getStoreProductId($store_id);
        $otherProduct = $this->getOtherPorudctId($chn_id, $store_id);

        $syncProduct = array_diff($storeProduct, $otherProduct);

        $field = array(
            "ID",
            "AppClass"
        );

        $field = implode(", ", $field);
        $productInfo = $this->getProductInfoById($syncProduct, $field);

        $productInfo = $this->setProductOtherCategory($chn_id, $store_id, $productInfo);

        $res = array();
        if($chn_id == 1){
            $res = $this->syncMtProduct($store_id, $productInfo);
        }

        if($chn_id == 2){
            $res = $this->syncBdProduct($store_id, $productInfo);
        }

        if($chn_id == 3){
            $res = $this->syncJddjProduct($store_id, $productInfo);
        }

        if($chn_id == 4){
            $res = $this->syncElemeProduct($store_id, $productInfo);
        }

        return $res;
    }

    /*
        同步美团商品
        params
            store_id 店铺id
            product_info[] 商品信息数组对象
    */
    public function syncMtProduct($store_id = 0, $product_info = array())
    {
        $this->load->model("MtApi_model", "MtApiModel");
        $MtApiModel = $this->MtApiModel;

        return $MtApiModel->syncProduct($store_id, $product_info);
    }

    /*
        同步百度商品
        params
            store_id 店铺id
            product_info[] 商品信息数组对象
    */
    public function syncBdProduct($store_id = 0, $product_info = array())
    {
        $this->load->model("BdApi_model", "BdApiModel");
        $BdApiModel = $this->BdApiModel;

        return $BdApiModel->syncProduct($store_id, $product_info);
    }

    /*
        同步饿了么商品
        params
            store_id 店铺id
            product_info[] 商品信息数组对象
    */
    public function syncElemeProduct($store_id = 0, $product_info = array())
    {
        $this->load->model("ElemeApi_model", "ElemeApiModel");
        $ElemeApiModel = $this->ElemeApiModel;

        return $ElemeApiModel->syncProduct($store_id, $product_info);
    }

    /*
        同步京东到家商品
        params
            store_id 店铺id
            product_info[] 商品信息数组对象
    */
    public function syncJddjProduct($store_id = 0, $product_info = array())
    {
        $this->load->model("JddjApi_model", "JddjApiModel");
        $JddjApiModel = $this->JddjApiModel;

        return $JddjApiModel->syncProduct($store_id, $product_info);
    }

    /*
        设置商品分类信息
        params
            chn_id 渠道id
            store_id 店铺id
            product_info[] 商品信息对象数组      
    */
    public function setProductOtherCategory($chn_id, $store_id, $product_info = array())
    {
        $otherCategory = $this->getStoreCategoryToOtherCategory($chn_id, $store_id);

        foreach ($product_info as $key => $value) {
            $tmpName = $otherCategory[$value['AppClass']]['other_category_name'];

            if(empty($tmpName)){
                unset($product_info[$key]);
                continue;
            }

            $product_info[$key]['category_name'] = $tmpName;
            $product_info[$key]['other_category_id'] = $otherCategory[$value['AppClass']]['other_category_id'];
        }

        return $product_info;
    }

    /*
        获取本地药品id列表
        params
            store_id 店铺id
    */
    public function getStoreProductId($store_id = 0)
    {
        $this->load->model("StoreProduct_model", "StoreProductModel");
        $StoreProductModel = $this->StoreProductModel;

        return $StoreProductModel->getProductIdList($store_id);
    }

    /*
        获取药品信息
        params
            product_id[] 商品id数组
            field 查询的字段
    */
    public function getProductInfoById($product_id = array(), $field = "*")
    {
        $this->load->model("Product_model", "ProductModel");
        $ProductModel = $this->ProductModel;

        return $ProductModel->getProductInfoById($product_id, $field);
    }

    /*
        获取药品分类
    */
    public function getProductCategory()
    {
        $this->load->model("Product_model", "ProductModel");
        $ProductModel = $this->ProductModel;

        return $ProductModel->getProductCategory();
    }

    /*
        获取本地分类对应的第三方分类
        params
            chn_id 渠道id
            store_id 店铺id
    */
    public function getStoreCategoryToOtherCategory($chn_id = 0, $store_id = 0)
    {
        $this->load->model("ChannelCategory_model", "ChannelCategoryModel");
        $ChannelCategoryModel = $this->ChannelCategoryModel;

        return $ChannelCategoryModel->getStoreCategoryToOtherCategory($chn_id, $store_id);
    }

    /*
        获取同步商品队列数量
        params
            chn_id 渠道id
    */
    public function getSyncQueueCnt($chn_id = 0)
    {
        $chnKey = array(
            "1" => "MEITUAN",
            "2" => "BAIDU",
            "3" => "JINGDONGDJ",
            "4" => "ELEME",
        );

        $key = sprintf("KCS_QUEUE_%s_SYNC_PRODUCT", $chnKey[$chn_id]);

        $this->load->library("MyRedis", '', "MyRedis");
        $MyRedis = $this->MyRedis;

        return intval($MyRedis->LLEN($key));
    }

    /*
        获取商品库存列表
        params
            store_id 店铺id
    */
    public function getProductStock($store_id = 0)
    {
        $productStock = $this->getProductStockByStore($store_id);
        $otherProductStock = $this->getChannelProductStock($store_id);

        $otherProductStock = $this->setProductStock($productStock, $otherProductStock);
        $otherProductStock = $this->setChannelName($otherProductStock);

        $otherProductStock = $this->setProductInfo($otherProductStock);

        return $otherProductStock;
    }

    /*
        设置商品库存信息
        params
            product_stock 本地库存信息对象
            other_product_stock 第三方库存信息对象
    */
    public function setProductStock($product_stock = array(), $other_product_stock = array())
    {
        foreach ($other_product_stock as $key => $value) {
            $product_id = $value['product_id'];
            $stock = intval($product_stock[$product_id]);

            $stock = $stock < 2 ? 0 : $stock;

            $other_product_stock[$key]['product_stock'] = $stock;
        }

        return $other_product_stock;
    }

    /*
        获取商品库存信息
        params
            store_id 店铺id
    */
    public function getProductStockByStore($store_id = 0)
    {
        $this->load->model("Product_model", "ProductModel");
        $ProductModel = $this->ProductModel;

        return $ProductModel->getProductStockByStore($store_id);
    }

    /*
        获取渠道商品库存信息
        params
            store_id 店铺id
    */
    public function getChannelProductStock($store_id = 0)
    {
        $where = array(
            "fk_store_id" => $store_id
        );

        $productList = $this->db
            ->select("fk_channel_id,other_product_id,fk_product_id product_id, product_stock other_product_stock")
            ->order_by("id desc")
            ->get_where($this->tabName, $where)
            ->result_array();

        return $productList;
    }

    /*
        设置第三方渠道名称
        params
            product_info[] 商品信息数组对象
    */
    public function setChannelName($product_info = array())
    {
        $this->load->model("Common_model", "CommonModel");
        $CommonModel = $this->CommonModel;
        $channel = $CommonModel->getAllChannelInfo();

        foreach ($product_info as $key => $value) {
            $chn_id = $value['fk_channel_id'];
            $product_info[$key]['channel_name'] = $channel[$chn_id]['name'];
        }

        return $product_info;
    }

    /*
        设置商品信息
        params
            product_name[] 商品信息数组对象
    */
    public function setProductInfo($product_info = array())
    {
        $productId = array();

        foreach ($product_info as $key => $value) {
            $product_id = $value['product_id'];
            $productId[$product_id] = 0;
        }

        $productId = array_keys($productId);

        $field = array(
            "ID",
            "CompanyName",
            "Caption",
            "ModeSize",
            "AppClass",
            "LSJG"
        );
        $field = implode(", ", $field);
        $productInfo = $this->getProductInfoById($productId, $field);

        foreach ($product_info as $key => $value) {
            $product_id = $value['product_id'];
            $product_info[$key] = array_merge($value, $productInfo[$product_id]);
        }

        return $product_info;
    }

    /*
        提交同步第三方库存请求
        params
            store_id 店铺id
    */
    public function commitSyncStock($store_id = 0)
    {
        $productStock = $this->getProductStockByStore($store_id);
        $otherProductStock = $this->getChannelProductStock($store_id);

        $otherProductStock = $this->setProductStock($productStock, $otherProductStock);

        $syncQueue = array();

        foreach ($otherProductStock as $key => $value) {
            $chn_id = $value['fk_channel_id'];
            $other_product_id = $value['other_product_id'];
            $product_stock = $value['product_stock'];
            $other_product_stock = $value['other_product_stock'];

            if($product_stock != $other_product_stock){
                $syncQueue[$chn_id][] = array(
                    "store_id" => $store_id,
                    "other_product_id" => $other_product_id,
                    "product_stock" => $product_stock
                );
            }
        }

        $this->addSyncStockToQueue($syncQueue);

        $res = array(
            "status" => "success"
        );

        return $res;
    }

    /*
        添加同步库存记录到队列
        params
            sync_stock_queue 商品同步队列数据对象
    */
    public function addSyncStockToQueue($sync_stock_queue = array())
    {
        if(empty($sync_stock_queue["1"]) == false){
            $this->addMtSyncStockToQueue($sync_stock_queue["1"]);
        }

        if(empty($sync_stock_queue["2"]) == false){
            $this->addBdSyncStockToQueue($sync_stock_queue["2"]);
        }

        if(empty($sync_stock_queue["3"]) == false){
            $this->addJddjSyncStockToQueue($sync_stock_queue["3"]);
        }

        if(empty($sync_stock_queue["4"]) == false){
            $this->addElemeSyncStockToQueue($sync_stock_queue["4"]);
        }
    }



    /*
        添加美团同步库存记录到队列
        params
            sync_stock_queue 商品同步队列数据对象
    */
    public function addMtSyncStockToQueue($sync_stock_queue = array())
    {
        $this->load->model("MtApi_model", "MtApiModel");
        $MtApiModel = $this->MtApiModel;

        return $MtApiModel->syncStock($sync_stock_queue);
    }



    /*
        添加百度同步库存记录到队列
        params
            sync_stock_queue 商品同步队列数据对象
    */
    public function addBdSyncStockToQueue($sync_stock_queue = array())
    {
        $this->load->model("BdApi_model", "BdApiModel");
        $BdApiModel = $this->BdApiModel;

        return $BdApiModel->syncStock($sync_stock_queue);
    }

    /*
        添加京东到家同步库存记录到队列
        params
            sync_stock_queue 商品同步队列数据对象
    */
    public function addJddjSyncStockToQueue($sync_stock_queue = array())
    {
        $this->load->model("JddjApi_model", "JddjApiModel");
        $JddjApiModel = $this->JddjApiModel;

        return $JddjApiModel->syncStock($sync_stock_queue);
    }

    /*
        添加饿了么同步库存记录到队列
        params
            sync_stock_queue 商品同步队列数据对象
    */
    public function addElemeSyncStockToQueue($sync_stock_queue = array())
    {
        $this->load->model("ElemeApi_model", "ElemeApiModel");
        $ElemeApiModel = $this->ElemeApiModel;

        return $ElemeApiModel->syncStock($sync_stock_queue);
    }
    

    /*
        获取商品库存同步队列数量
    */
    public function getSyncStockQueueCnt()
    {
        $chnKey = array(
            "1" => "MEITUAN",
            "2" => "BAIDU",
            "3" => "JINGDONGDJ",
            "4" => "ELEME",
        );

        $this->load->library("MyRedis", '', "MyRedis");
        $MyRedis = $this->MyRedis;

        $res = array();

        foreach ($chnKey as $key => $value) {
            $queueKey = sprintf("KCS_QUEUE_%s_SYNC_PRODUCT_STOCK", $value);

            $res[$key] = $MyRedis->LLEN($queueKey);
        }

        return $res;
    }

    /*
        获取商品库存同步队列数量
    */
    public function getSyncPriceQueueCnt()
    {
        $chnKey = array(
            "1" => "MEITUAN",
            "2" => "BAIDU",
            "3" => "JINGDONGDJ",
            "4" => "ELEME",
        );

        $this->load->library("MyRedis", '', "MyRedis");
        $MyRedis = $this->MyRedis;

        $res = array();

        foreach ($chnKey as $key => $value) {
            $queueKey = sprintf("KCS_QUEUE_%s_SYNC_PRODUCT_PRICE", $value);

            $res[$key] = $MyRedis->LLEN($queueKey);
        }

        return $res;
    }

    /*
        获取同步商品价格列表
        params
            chn_id[] 渠道id数组 [1,2,3]
            store_id[] 店铺id数组 [2,4,5,6]
            product_info[] 商品价格数组 [5 => 1000, product_id => product_price]
    */
    public function getSyncPriceList($chn_id = array(), $store_id = array(), $product_info = array()){
        $otherAllProduct = $this->getAllOtherPriceByStoreIdArr($store_id);
        $otherProductPrice = $this->formatProductPriceInfo($otherAllProduct);

        $field = array(
            "ID",
            "Caption"
        );
        $field = implode(", ", $field);

        $storeInfo = $this->getStoreInfoByStoreId($store_id, $field);


        $productId = array_keys($product_info);

        $field = array(
            "ID",
            "CompanyName",
            "Caption",
            "ModeSize",
            "AppClass",
            "LSJG"
        );
        $field = implode(", ", $field);
        $productInfo = $this->getProductInfoById($productId, $field);

        $newProductPrice = array();

        foreach ($chn_id as $c_key => $c_value) {
            foreach ($store_id as $s_key => $s_value) {
                foreach ($product_info as $p_key => $p_value) {
                    $tmpChnId = $c_value;
                    $tmpStoreId = $s_value;
                    $tmpProductId = $p_key;
                    $tmpProductPrice = $p_value;

                    if(isset($otherProductPrice[$tmpChnId][$tmpStoreId][$tmpProductId])){
                        $tmpData = $otherProductPrice[$tmpChnId][$tmpStoreId][$tmpProductId];
                        $tmpData['new_other_price'] = $tmpProductPrice;
                        $tmpData['product_info'] = $productInfo[$tmpProductId];
                        $tmpData['store_name'] = $storeInfo[$tmpStoreId]['Caption'];

                        $newProductPrice[] = $tmpData;
                    }
                }
            }
        }

        $newProductPrice = $this->setChannelName($newProductPrice);
        return $newProductPrice;
    }

    /*
        提交同步商品价格列表
        params
            chn_id[] 渠道id数组 [1,2,3]
            store_id[] 店铺id数组 [2,4,5,6]
            product_info[] 商品价格数组 [5 => 1000, product_id => product_price]
    */
    public function commitSyncPriceList($chn_id = array(), $store_id = array(), $product_info = array()){
        $otherAllProduct = $this->getAllOtherPriceByStoreIdArr($store_id);
        $otherProductPrice = $this->formatProductPriceInfo($otherAllProduct);

        $newProductPrice = array();

        foreach ($chn_id as $c_key => $c_value) {
            foreach ($store_id as $s_key => $s_value) {
                foreach ($product_info as $p_key => $p_value) {
                    $tmpChnId = $c_value;
                    $tmpStoreId = $s_value;
                    $tmpProductId = $p_key;
                    $tmpProductPrice = $p_value;

                    if(isset($otherProductPrice[$tmpChnId][$tmpStoreId][$tmpProductId])){
                        $tmpData = $otherProductPrice[$tmpChnId][$tmpStoreId][$tmpProductId];
                        $other_product_id = $tmpData['other_product_id'];
                        $newProductPrice[$tmpChnId][] = array(
                            "store_id" => $tmpStoreId,
                            "other_product_id" => $other_product_id,
                            "product_price" => $tmpProductPrice,
                        );
                    }
                }
            }
        }

        $this->addSyncPriceToQueue($newProductPrice);
        return true;
    }

    /*
        格式化店铺商品价格数据
        params
            product_info[] 商品价格数据数组
            [
                3 => [
                    [
                        fk_product_id => 2451, 
                        fk_channel_id => 4, 
                        other_product_id => 1287493278, 
                        product_price => 225
                    ]
                ]
            ]
    */
    public function formatProductPriceInfo($product_info = array())
    {
        $res = array();

        foreach ($product_info as $key => $value) {
            $storeProduct = $value;
            $storeId = $key;

            foreach ($storeProduct as $p_key => $p_value) {
                $chnId = $p_value['fk_channel_id'];
                $productId = $p_value['fk_product_id'];

                $otherProductId = $p_value['other_product_id'];
                $otherProductPrice = $p_value['product_price'];

                $res[$chnId][$storeId][$productId] = array(
                    "fk_channel_id" => $chnId,
                    "fk_store_id" => $storeId,
                    "fk_product_id" => $productId,
                    "other_product_id" => $otherProductId,
                    "other_product_price" => $otherProductPrice,
                );
            }
        }

        return $res;
    }

    /*
        通过药店数组id获取全部第三方商品
        params
            store_id[] 店铺id数组 [2,4,5,6]
    */
    public function getAllOtherPriceByStoreIdArr($store_id = array())
    {
        $res = array();

        foreach ($store_id as $key => $value) {
            $productList = $this->getAllOtherPriceByStoreId($value);

            if(empty($productList) == false){
                $res[$value] = $productList;
            }
        }

        return $res;
    }

    /*
        通过渠道id数组获取药店id
        params
            chn_id[] 渠道id数组 [1,2,3]
    */
    public function getStoreIdByChnIdArr($chn_id = array())
    {
        $res = array();
        foreach ($chn_id as $key => $value) {
            $storeId = $this->getStoreIdByChnId($value);

            if(empty($storeId) == false){
                $res[$value] = $storeId;
            }
        }

        return $res;
    }

    /*
        通过渠道id获取药店id列表
        params
            chn_id 渠道id
    */
    public function getStoreIdByChnId($chn_id = '')
    {
        $this->load->model("ChannelStore_model", "ChannelStoreModel");
        $ChannelStoreModel = $this->ChannelStoreModel;

        return $ChannelStoreModel->getStoreIdByChnId($chn_id);
    }

    /*
        通过药店id获取药店信息
        params
            store_id[] 药店id数组
            field 查询字段       
    */
    public function getStoreInfoByStoreId($store_id = array(), $field = "*")
    {
        $this->load->model("Store_model", "StoreModel");
        $StoreModel = $this->StoreModel;

        return $StoreModel->getStoreInfoByStoreId($store_id, $field);
    }

    /*
        添加同步库存记录到队列
        params
            sync_price_queue 商品同步队列数据对象
    */
    public function addSyncPriceToQueue($sync_price_queue = array())
    {
        if(empty($sync_price_queue["1"]) == false){
            $this->addMtSyncPriceToQueue($sync_price_queue["1"]);
        }

        if(empty($sync_price_queue["2"]) == false){
            $this->addBdSyncPriceToQueue($sync_price_queue["2"]);
        }

        if(empty($sync_price_queue["3"]) == false){
            $this->addJddjSyncPriceToQueue($sync_price_queue["3"]);
        }

        if(empty($sync_price_queue["4"]) == false){
            $this->addElemeSyncPriceToQueue($sync_price_queue["4"]);
        }
    }



    /*
        添加美团同步库存记录到队列
        params
            sync_price_queue 商品同步队列数据对象
    */
    public function addMtSyncPriceToQueue($sync_price_queue = array())
    {
        $this->load->model("MtApi_model", "MtApiModel");
        $MtApiModel = $this->MtApiModel;

        return $MtApiModel->syncPrice($sync_price_queue);
    }



    /*
        添加百度同步库存记录到队列
        params
            sync_price_queue 商品同步队列数据对象
    */
    public function addBdSyncPriceToQueue($sync_price_queue = array())
    {
        $this->load->model("BdApi_model", "BdApiModel");
        $BdApiModel = $this->BdApiModel;

        return $BdApiModel->syncPrice($sync_price_queue);
    }

    /*
        添加京东到家同步库存记录到队列
        params
            sync_price_queue 商品同步队列数据对象
    */
    public function addJddjSyncPriceToQueue($sync_price_queue = array())
    {
        $this->load->model("JddjApi_model", "JddjApiModel");
        $JddjApiModel = $this->JddjApiModel;

        return $JddjApiModel->syncPrice($sync_price_queue);
    }

    /*
        添加饿了么同步库存记录到队列
        params
            sync_price_queue 商品同步队列数据对象
    */
    public function addElemeSyncPriceToQueue($sync_price_queue = array())
    {
        $this->load->model("ElemeApi_model", "ElemeApiModel");
        $ElemeApiModel = $this->ElemeApiModel;

        return $ElemeApiModel->syncPrice($sync_price_queue);
    }
}